find_program(NSIS_EXECUTABLE
	NAMES makensis.exe
	PATHS "C:/Program Files/NSIS/"
)

if (NSIS_EXECUTABLE)

	message(STATUS "Found NSIS: ${NSIS_EXECUTABLE}")

	add_custom_target(nsis
		${NSIS_EXECUTABLE}
		/DBUILD_DIR="${BUILD_DIR}"
		/DPRODUCT_NAME="${QUARKPLAYER_NAME}"
		/DPRODUCT_VERSION="${QUARKPLAYER_VERSION}"
		/DBINARY_NAME="${QUARKPLAYER_BINARY_NAME}"
		/DPRODUCT_DESCRIPTION="${QUARKPLAYER_DESCRIPTION_SUMMARY}"
		/DPRODUCT_PUBLISHER="${QUARKPLAYER_AUTHORS}"
		/DPRODUCT_URL="${QUARKPLAYER_URL}"
		/DPRODUCT_COPYRIGHT="${QUARKPLAYER_COPYRIGHT}"
		/DPRODUCT_LICENSE_FILE="${QUARKPLAYER_LICENSE_FILE}"
		/DINSTALLER_NAME="${CMAKE_BINARY_DIR}/${QUARKPLAYER_PACKAGE_FILE}.exe"
		/DCOMPILER_NAME="${COMPILER_NAME}"
		/DBUILD_TYPE="${CMAKE_BUILD_TYPE}"
		${CMAKE_SOURCE_DIR}/packaging/nsis/installer.nsi
		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
	)

else (NSIS_EXECUTABLE)
	message(STATUS "Could not find NSIS")
endif (NSIS_EXECUTABLE)
